package cn.edu.scau.cmi.dengyu.client;

import cn.edu.scau.cmi.dengyu.adapter.AdapterOfClass;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class AdapterOfClassClient extends Application{
	private static TextArea taDescription = new TextArea();
	Stage stage = new Stage();

	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		VBox vBox = new VBox(10);
		vBox.setPadding(new Insets(15, 5, 5, 5));
		Button btAdapterOfClass = new Button("类适配器");
		taDescription.setWrapText(true);
		taDescription.setEditable(false);
		btAdapterOfClass.setOnAction(e -> setDisplayText(new AdapterOfClass().doSomethingInTarget()));

		vBox.getChildren().addAll(btAdapterOfClass, taDescription);
		Scene scene = new Scene(vBox, 400, 300);
		primaryStage.setTitle("实验三 类适配器模式");
		primaryStage.setScene(scene);
		primaryStage.show();
	}
	

	public static void setDisplayText(String str) {
		taDescription.setText(str);
	}

	public static void main(String[] args) {
		Application.launch(args);
	}

	public void showWindow() throws Exception {
		start(stage);				
	}
}
